// 封装部门相关的接口
import request from '@/utils/request'
/**
 * 获取组织架构数据
 * @returns
 */
export function getDepartmentList() {
  return request({
    url: '/company/department'
  })
}

/**
 * 根据ID删除部门
 * @param {*} id 部门id
 * @returns
 */
export function delDepartment(id) {
  return request({
    method: 'DELETE',
    url: `/company/department/${id}`
  })
}

/**
 * 添加部门
 * @param {*} data 部门数据
 * @returns
 */
export function addDepartment(data) {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}

/**
 * 获取部门详情
 * @param {*} id
 * @returns
 */
export function getDepartmentDetail(id) {
  return request({
    method: 'get',
    url: '/company/department/' + id
  })
}

/**
 * 修改部门
 * @param {*} data
 * @returns
 */
export function updateDepartment(data) {
  return request({
    method: 'PUT',
    url: `/company/department/${data.id}`,
    data
  })
}
